//
//  Data+QZSwiftUI.swift
//  CrseAsst
//
//  Created by 申铭 on 2024/2/26.
//

import SwiftUI

extension Data {
    func toColor() -> Color {
        do {
            guard let color = try NSKeyedUnarchiver.unarchivedObject(ofClass: UIColor.self, from: self) else {
                return .clear
            }
            
            return Color(color)
        } catch {
            log.error("颜色转换失败:\(error)")
        }

        return .clear
    }
}
